{{define "header"}}
<link rel="stylesheet" href="buildlog.css">
<script type="text/javascript" src="script_bundle.min.js"></script>
{{end}}
{{define "body"}}
<div>
{{range $log := .LogViews}}
  <div>
    <button class="show-all-button" data-artifact="{{$log.ArtifactName}}">Show all hidden lines</button>
    {{if .ShowRawLog}}<a href="{{$log.ArtifactLink}}" style="padding-left:15px;">Raw {{$log.ArtifactName}}<i class="material-icons" style="font-size: 1em; vertical-align: middle; padding-left: 3px;">open_in_new</i></a>{{end}}
    <div class="loglines" id="{{$log.ArtifactName}}-content" style="font-family: monospace; margin-top: 15px;">
      {{range $g := $log.LineGroups}}
        {{if $g.Skip}}
          <div class="show-skipped" data-artifact="{{$log.ArtifactName}}" data-offset="{{$g.ByteOffset}}" data-length="{{$g.ByteLength}}" data-start-line="{{$g.Start}}" data-end-line="{{$g.End}}">
            <div>
              <div class="linenum"></div>
              <div class="linetext"><button> skipped {{$g.LinesSkipped}} lines <i class="material-icons" style="font-size: 1em; vertical-align: middle;">unfold_more</i></button></div>
            </div>
          </div>
        {{else}}
          <div class="shown">
          {{template "line group" $g.LogLines}}
          </div>
        {{end}}
      {{end}}
    </div>
  </div>
{{end}}
</div>
{{end}}

{{define "line group"}}
  {{range .}}
    <div id="{{.ArtifactName}}:{{.Number}}">
      <div class="linenum"><a href="#{{.ArtifactName}}:{{.Number}}" data-artifact="{{.ArtifactName}}" data-line-number="{{.Number}}">{{.Number}}</a></div>
      <div class="linetext">
        <span {{if .Highlighted}}class="line-highlighted"{{end}}>
          {{- range .SubLines -}}<span {{if .Highlighted}}class="match-highlighted"{{end}}>{{.Text}}</span>{{- end -}}
        </span>
      </div>
    </div>
  {{end}}
{{end}}
